//Particle System Vertex Shader
uniform mat4 uMVPMatrix;
uniform float uTime;
uniform vec3 uCenterPosition;
attribute float aLifeTime;
attribute vec3 aStartPosition;
attribute vec3 aEndPosition;
varying float vLifeTime;

void main(){
    if(uTime <= aLifeTime){
        gl_Position.xyz = aStartPosition + (uTime * aEndPosition);
        gl_Position.xyz += uCenterPosition;
        //gl_Position.w = 1.0;
        gl_Position = uMVPMatrix * gl_Position;
    }else{
        //gl_Position = vec4(-1000,-1000,0,0);
        gl_Position = uMVPMatrix * vec4(-1000,-1000,0,0);
    }
    vLifeTime = 1.0 - (uTime / aLifeTime);
    vLifeTime = clamp(vLifeTime,0.0,1.0);
    gl_PointSize = (vLifeTime * vLifeTime) * 40.0;
}
